﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System.IO;



public enum InfoType
{
    Read,
    Write
}

public class OwnInfoManager : MonoBehaviour
{
    public event EventExtends.infoType readWriteEvent;

    private void Awake()
    {
        readWriteEvent += ReadWriteData;
    }


    public string InvokeEvent(InfoType infoType, string path, string content) => readWriteEvent(infoType, path, content);




    private string ReadWriteData(InfoType infoType, string path, string writeContent)
    {
        if(infoType == InfoType.Read)
        {
            return File.ReadAllText(path);
        }
        else if(infoType == InfoType.Write)
        {
            File.WriteAllText(path, writeContent);
        }

        return string.Empty;
    }
}
